<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>全景视频 | 简介</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.4">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../part1/index.html" />
    
    
    <link rel="prev" href="../part0/hanlde_proguard.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="1.6"
        data-chapter-title="全景视频"
        data-filepath="part0/pano_video.md"
        data-basepath=".."
        data-revision="Mon Mar 07 2016 10:56:46 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="part0/index.html">
            
                
                    <a href="../part0/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        快速开始
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="part0/import_project.html">
            
                
                    <a href="../part0/import_project.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        集成工程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="part0/get_start_play.html">
            
                
                    <a href="../part0/get_start_play.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        启动播放器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="part0/handle_video_ratio.html">
            
                
                    <a href="../part0/handle_video_ratio.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        处理视频比例
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="part0/handle_video_view_change.html">
            
                
                    <a href="../part0/handle_video_view_change.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        处理屏幕旋转
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="part0/hanlde_proguard.html">
            
                
                    <a href="../part0/hanlde_proguard.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        关于混淆
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="1.6" data-path="part0/pano_video.html">
            
                
                    <a href="../part0/pano_video.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        全景视频
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="part1/index.html">
            
                
                    <a href="../part1/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        第一章
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="part1/player_structure.html">
            
                
                    <a href="../part1/player_structure.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        播放器基本架构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="part1/player_api_Intro.html">
            
                
                    <a href="../part1/player_api_Intro.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        LetvPlayer播放器API说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="part1/playcontext_introduction.html">
            
                
                    <a href="../part1/playcontext_introduction.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        PlayContext ApI说明
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="download/download_module.html">
            
                
                    <a href="../download/download_module.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        下载模块
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="download/download_letter.html">
            
                
                    <a href="../download/download_letter.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        快速接入
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="download/download_center.html">
            
                
                    <a href="../download/download_center.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        DownloadCenter API说明文档
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="download/download_observer.html">
            
                
                    <a href="../download/download_observer.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        LeDownloadObserver API说明文档
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="download/download_info.html">
            
                
                    <a href="../download/download_info.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        LeDownloadInfo API 说明文档
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="update.html">
            
                
                    <a href="../update.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        更新说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="fqa.html">
            
                
                    <a href="../fqa.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Q&amp;A
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                     
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >简介</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5168;&#x666F;&#x89C6;&#x9891;">&#x5168;&#x666F;&#x89C6;&#x9891;</h1>
<blockquote>
<p>&#x8BE5;&#x6587;&#x6863;&#x5305;&#x542B;&#x64AD;&#x653E;&#x4E50;&#x89C6;&#x4E91;&#x5B98;&#x65B9;&#x7684;&#x5168;&#x666F;&#x89C6;&#x9891;&#x4EE5;&#x53CA;&#x5916;&#x90E8;url(&#x6216;&#x8005;sdcard&#x8DEF;&#x5F84;)&#x5168;&#x666F;&#x89C6;&#x9891;</p>
</blockquote>
<p>&#x64AD;&#x653E;&#x4E50;&#x89C6;&#x4E91;&#x5168;&#x666F;</p>
<ul>
<li>&#x6240;&#x4F9D;&#x8D56;&#x7684;jar: Rajawali</li>
<li>&#x6CE8;&#x610F;&#xFF1A;&#x53EA;&#x652F;&#x6301;&#x786C;&#x89E3;&#x7801;</li>
<li>&#x64AD;&#x653E;&#x5668;&#x901A;&#x77E5;&#x4E0A;&#x5C42;&#x51C6;&#x5907;video view bundle &#x4E2D;&#x5305;&#x542B; key = &quot;pano&quot; &#x7684;boolean&#x503C; pano = true &#x6807;&#x8BC6;&#x8BE5;&#x89C6;&#x9891;&#x4E3A;&#x5168;&#x666F;&#x89C6;&#x9891;&#xFF1B;</li>
</ul>
<pre><code class="lang-java">
        <span class="hljs-comment">/**
         * &#x5904;&#x7406;&#x64AD;&#x653E;&#x5668;&#x4E8B;&#x4EF6;
         *
         * <span class="hljs-doctag">@param</span> state
         * <span class="hljs-doctag">@param</span> bundle
         */</span>
        <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">handlePlayState</span><span class="hljs-params">(<span class="hljs-keyword">int</span> state, Bundle bundle)</span> </span>{
            <span class="hljs-keyword">switch</span> (state) {
                ...
                <span class="hljs-keyword">case</span> ISplayer.PLAYER_EVENT_PREPARE_VIDEO_VIEW:
                    <span class="hljs-keyword">boolean</span> pano = bundle != <span class="hljs-keyword">null</span> ? bundle.getBoolean(<span class="hljs-string">&quot;pano&quot;</span>, <span class="hljs-keyword">false</span>) : <span class="hljs-keyword">false</span>;
                    <span class="hljs-keyword">if</span> (pano) {
                        initPanoVideoView();
                    } <span class="hljs-keyword">else</span> {
                        initNormalVideoView();
                    }
                    playContext.setVideoContentView(videoView.getMysef());
                    <span class="hljs-keyword">break</span>;
            }

             <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">initNormalVideoView</span><span class="hljs-params">()</span> </span>{
                    <span class="hljs-keyword">if</span> (videoView == <span class="hljs-keyword">null</span> || !(videoView <span class="hljs-keyword">instanceof</span> ReSurfaceView)) {
                        videoView = <span class="hljs-keyword">new</span> ReSurfaceView(mContext);
                        videoView.getHolder().addCallback(surfaceCallback);
                        videoView.setVideoContainer(<span class="hljs-keyword">null</span>);
                        RelativeLayout.LayoutParams params = <span class="hljs-keyword">new</span> RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                        params.addRule(RelativeLayout.CENTER_IN_PARENT);
                        skin.addVideoView(videoView.getMysef(), params);
                    }
                }

                <span class="hljs-keyword">private</span> Surface mSurface;

                <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">initPanoVideoView</span><span class="hljs-params">()</span> </span>{
                    <span class="hljs-keyword">if</span> (videoView == <span class="hljs-keyword">null</span> || !(videoView.getMysef() <span class="hljs-keyword">instanceof</span> PanoVideoView)) {
                        <span class="hljs-keyword">final</span> PanoVideoView panoVideoView = <span class="hljs-keyword">new</span> PanoVideoView(mContext);
                        panoVideoView.registerSurfacelistener(<span class="hljs-keyword">new</span> ISurfaceListener() {

                            <span class="hljs-annotation">@Override</span>
                            <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">setSurface</span><span class="hljs-params">(Surface surface)</span> </span>{
                                <span class="hljs-keyword">if</span> (mSurface != <span class="hljs-keyword">null</span>) {
                                    mSurface.release();
                                }
                                mSurface = surface;
                                player.suspend();
                                player.setDisplay(surface);
                                player.regain();

                                <span class="hljs-comment">//&#x8BBE;&#x7F6E;video&#x7684;&#x5355;&#x51FB;&#x4E8B;&#x4EF6; &#x901A;&#x77E5;&#x4E0A;&#x5C42;&#x5524;&#x9192;&#x64AD;&#x63A7;&#x63A7;&#x4EF6;&#x7B49;</span>
                                panoVideoView.setTapUpListener(<span class="hljs-keyword">new</span> OnPanoViewTapUpListener() {
                                    <span class="hljs-annotation">@Override</span>
                                    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onSingleTapUp</span><span class="hljs-params">(MotionEvent e)</span> </span>{
                                        skin.performClick();
                                    }
                                });
                            }
                        });

                        <span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x624B;&#x52BF;&#x64CD;&#x4F5C;&#x5C42;&#x7684;touch&#x4E8B;&#x4EF6;</span>
                        <span class="hljs-comment">//&#x5982;&#x679C;&#x624B;&#x52BF;&#x4E0D;&#x8D77;&#x4F5C;&#x7528;&#x6709;&#x53EF;&#x80FD;&#x662F;&#x60A8;&#x7684;layout&#x628A;panovideoview&#x7684;&#x624B;&#x52BF;&#x4E8B;&#x4EF6;&#x8986;&#x76D6; &#x8FD9;&#x91CC;&#x4E5F;&#x53EF;&#x4EE5;&#x8BBE;&#x7F6E;&#x60A8;&#x7684;layout&#x4E2D;&#x6700;&#x4E0A;&#x5C42;view</span>
                        panoVideoView.setOnTouchListener(<span class="hljs-keyword">new</span> View.OnTouchListener() {
                            <span class="hljs-annotation">@Override</span>
                            <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">boolean</span> <span class="hljs-title">onTouch</span><span class="hljs-params">(View v, MotionEvent event)</span> </span>{
                                <span class="hljs-keyword">return</span> panoVideoView.onPanoTouch(v, event);
                            }
                        });
                        panoVideoView.init();
                        videoView = panoVideoView;
                        videoView.getHolder().addCallback(surfaceCallback);
                        RelativeLayout.LayoutParams params = <span class="hljs-keyword">new</span> RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                        params.addRule(RelativeLayout.CENTER_IN_PARENT);
                        skin.addVideoView(videoView.getMysef(), params);
                        skin.initPanoView();
                    } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (mSurface != <span class="hljs-keyword">null</span>) {
                        <span class="hljs-comment">//&#x64AD;&#x653E;&#x4E0B;&#x4E00;&#x89C6;&#x9891;&#x65F6;&#x5019; &#x91CD;&#x590D;&#x5229;&#x7528;surface &#x9700;&#x8981;&#x8BBE;&#x7F6E;&#x7ED9;&#x65B0;&#x7684;&#x64AD;&#x653E;&#x5668;</span>
                        player.suspend();
                        player.setDisplay(mSurface);
                        player.regain();
                    }
                }
</code></pre>
<p>&#x64AD;&#x653E;&#x5916;&#x90E8;url&#x6216;&#x8005;sdcard&#x5168;&#x666F;&#x89C6;&#x9891;</p>
<pre><code class="lang-java">
        <span class="hljs-comment">//&#x5F3A;&#x5236;&#x4F7F;&#x7528;&#x5168;&#x666F; &#x9002;&#x7528;&#x4E8E; &#x64AD;&#x653E;&#x672C;&#x5730; &#x6216;&#x8005;&#x64AD;&#x653E;&#x5176;&#x4ED6;&#x6765;&#x6E90;&#x7684;&#x5168;&#x666F;&#x89C6;&#x9891;</span>
        playContext.setLocalFilePano(isLocalPano);      
        playContext.setUsePlayerProxy(<span class="hljs-keyword">false</span>);
        ...
        player.setDataSource(path);
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../part0/hanlde_proguard.html" class="navigation navigation-prev " aria-label="Previous page: 关于混淆"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../part1/index.html" class="navigation navigation-next " aria-label="Next page: 第一章"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
